<?php
$title = '网课平台';
require_once('head.php');
?>
<link rel="stylesheet" href="/ydsj/static/element.css" />
<link href="https://fastly.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.0.0/css/all.min.css" rel="stylesheet">
<style>
    /* 全局样式 */
    body {
        background-color: #f7f8fa;
        color: #323233;
        font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Segoe UI, Arial, Roboto, 'PingFang SC', 'miui', 'Hiragino Sans GB', 'Microsoft Yahei', sans-serif;
    }

    .card-header {
        margin-top: 20px;
        margin-bottom: 10px;
    }

    .card-body {
        margin-top: 10px;
        margin-bottom: 20px;
    }

    .el-form-item {
        margin-bottom: 15px;
    }

    .el-form-item__label {
        line-height: 30px;
    }

    .el-form-item__content {
        line-height: 30px;
    }

    .el-form-item__error {
        padding-top: 0;
    }

    .el-dialog__body {
        height: auto;
        overflow: auto;
    }

    .price-tag {
        margin-left: 12px;
        font-size: 18px;
        font-weight: bold;
        color: #F56C6C;
    }

    .checkbox-group {
        display: flex;
        flex-wrap: wrap;
    }

    .checkbox-group .el-checkbox {
        margin-right: 15px;
        margin-bottom: 10px;
    }

    .panel-default {
        box-shadow: 0 4px 12px rgba(0,0,0,0.05);
        border-radius: 12px;
        margin-bottom: 24px;
        background: #fff;
        transition: all 0.3s ease;
        overflow: hidden;
    }

    .panel-default:hover {
        box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    }

    .panel-body {
        padding: 20px;
        border-radius: 7px;
    }

    .search-box {
        margin-bottom: 15px;
    }

    .price-summary {
        color: #606266;
        margin-right: 15px;
    }

    .price-highlight {
        color: #F56C6C;
        font-weight: bold;
        font-size: 16px;
    }

    /* 添加批量模式样式 */
    .mode-switch {
        margin-bottom: 20px;
        text-align: center;
    }

    .batch-table {
        margin-top: 20px;
    }

    .batch-actions {
        margin-top: 15px;
        display: flex;
        justify-content: space-between;
    }

    .upload-tip {
        font-size: 12px;
        color: #909399;
        margin-top: 10px;
    }

    /* 课程列表样式优化 */
    .course-item {
        display: flex;
        align-items: center;
        padding: 15px;
        border-radius: 8px;
        margin: 10px 0;
        background-color: #f9f9f9;
        border: 2px solid #eee;
        transition: all 0.3s ease;
        cursor: pointer;
        position: relative;
    }

    .course-item:hover {
        background-color: #f0f0f0;
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
        border-color: #d0d0d0;
    }

    .course-item.selected {
        background-color: #ecf5ff !important;
        border: 2px solid #409eff !important;
        transform: translateY(-2px) !important;
        box-shadow: 0 4px 12px rgba(64,158,255,.3) !important;
    }

    .course-item.selected::before {
        content: '✓';
        position: absolute;
        top: 8px;
        right: 8px;
        width: 24px;
        height: 24px;
        background-color: #409eff;
        color: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        z-index: 100;
        box-shadow: 0 2px 6px rgba(64,158,255,.5);
        animation: pulse 1.5s infinite;
    }

    @keyframes pulse {
        0% {
            box-shadow: 0 0 0 0 rgba(64, 158, 255, 0.7);
        }
        70% {
            box-shadow: 0 0 0 6px rgba(64, 158, 255, 0);
        }
        100% {
            box-shadow: 0 0 0 0 rgba(64, 158, 255, 0);
        }
    }

    .course-checkbox {
        margin-right: 15px;
        width: 18px;
        height: 18px;
    }

    .course-info {
        display: flex;
        flex-direction: column;
        flex: 1;
    }

    .course-image {
        width: 100px;
        height: 60px;
        border-radius: 4px;
        margin-right: 15px;
        object-fit: cover;
    }

    .course-name {
        font-weight: bold;
        font-size: 15px;
        color: #333;
        margin-bottom: 5px;
    }

    .course-id {
        font-size: 13px;
        color: #999;
    }

    /* 面板样式增强 */
    .panel-default {
        border: none;
        border-radius: 8px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
        overflow: hidden;
        margin-bottom: 20px;
        transition: all 0.3s;
    }

    .panel-default:hover {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
        transform: translateY(-2px);
    }

    .panel-heading {
        background: #f5f7fa !important;
        padding: 16px 20px !important;
        border-bottom: 1px solid #ebeef5 !important;
    }

    .panel-title {
        font-size: 16px !important;
        font-weight: 600 !important;
        color: #333 !important;
    }

    .panel-body {
        padding: 20px !important;
    }

    /* 表单元素美化 */
    .el-form-item {
        margin-bottom: 20px !important;
    }

    .el-input {
        width: 100% !important;
    }

    .el-select {
        width: 100% !important;
    }

    .el-input__inner {
        border-radius: 8px;
        border-color: #dcdfe6;
        transition: all 0.3s ease;
    }

    .el-input__inner:hover,
    .el-textarea__inner:hover {
        border-color: #c0c4cc;
    }

    .el-input__inner:focus,
    .el-textarea__inner:focus {
        border-color: #409eff;
        box-shadow: 0 0 0 2px rgba(64,158,255,.1);
    }

    /* 按钮美化 */
    .btn-primary, .el-button--primary {
        background-color: #409eff !important;
        border-color: #409eff !important;
        transition: all 0.3s !important;
        border-radius: 8px;
    }

    .btn-primary:hover, .el-button--primary:hover {
        background-color: #66b1ff !important;
        border-color: #66b1ff !important;
        transform: translateY(-2px) !important;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
    }

    .el-button {
        border-radius: 8px;
        padding: 10px 20px;
        font-weight: 500;
        transition: all 0.3s ease;
    }

    .el-button:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }

    .el-button--primary {
        background: linear-gradient(135deg, #409eff, #1989fa);
        border: none;
    }



    .el-button--warning {
        background: linear-gradient(135deg, #faad14, #e6a23c);
        border: none;
    }

    /* 查询结果区域样式 */
    .query-results-card {
        background-color: #fff;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
        transition: all 0.3s ease;
        overflow: hidden;
        margin-bottom: 20px;
    }

    .query-results-header {
        padding: 16px 20px;
        background: linear-gradient(135deg, #f0f6ff, #ecf5ff);
        color: #1e88e5;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid #e0eaff;
    }

    .query-results-title {
        font-size: 16px;
        font-weight: bold;
        display: flex;
        align-items: center;
    }

    .query-results-title i {
        margin-right: 8px;
        font-size: 18px;
    }

    /* 全选按钮样式 */
    .query-results-actions .btn-primary {
        background: linear-gradient(135deg, #409eff, #1989fa) !important;
        border: none !important;
        color: white !important;
        transition: all 0.3s ease !important;
        border-radius: 4px;
        padding: 6px 15px;
        font-weight: 500;
    }

    .query-results-actions .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
    }

    /* 状态标签样式 */
    .status-tag {
        display: inline-flex;
        align-items: center;
        padding: 4px 12px;
        border-radius: 20px;
        font-size: 13px;
        font-weight: 500;
        line-height: 1.4;
    }
    .status-tag i {
        margin-right: 4px;
        font-size: 12px;
    }
    .status-pending {
        background: #fff7e6;
        color: #d46b08;
        border: 1px solid #ffd591;
    }
    .status-processing {
        background: #e6f4ff;
        color: #0958d9;
        border: 1px solid #91caff;
    }
    .status-completed {
        background: #f6ffed;
        color: #389e0d;
        border: 1px solid #b7eb8f;
    }
    .status-error {
        background: #fff2f0;
        color: #cf1322;
        border: 1px solid #ffccc7;
    }

    /* 查询结果区域样式 */
    .query-results-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    }

    .query-results-header {
        padding: 18px 20px;
    }

    .query-results-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    /* 全选按钮样式优化 */
    .select-all-btn {
        position: relative;
        overflow: hidden;
        background: linear-gradient(135deg, #409eff, #1989fa) !important;
        border: none !important;
        color: white !important;
        transition: all 0.3s ease !important;
    }

    .select-all-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
    }

    .select-all-btn:active {
        transform: translateY(0);
    }

    .select-all-btn.active {
        background: linear-gradient(135deg, #67c23a, #52c41a) !important;
    }

    .select-all-btn.active i {
        animation: pulse 1.5s infinite;
    }

    @keyframes pulse {
        0% {
            transform: scale(1);
        }
        50% {
            transform: scale(1.2);
        }
        100% {
            transform: scale(1);
        }
    }

    /* 课程选中状态增强 */
    .course-item.selected::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        border: 2px solid #409eff;
        border-radius: 7px;
        box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
        pointer-events: none;
        animation: selectPulse 2s infinite;
    }

    @keyframes selectPulse {
        0% {
            box-shadow: 0 0 0 0 rgba(64, 158, 255, 0.4);
        }
        70% {
            box-shadow: 0 0 0 6px rgba(64, 158, 255, 0);
        }
        100% {
            box-shadow: 0 0 0 0 rgba(64, 158, 255, 0);
        }
    }

    /* 订单卡片样式 */
    .order-card {
        background: #fff;
        border-radius: 12px;
        padding: 20px;
        margin-bottom: 16px;
        box-shadow: 0 2px 12px rgba(0,0,0,0.04);
        transition: all 0.3s ease;
    }

    .order-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    }

    .order-title {
        font-size: 16px;
        font-weight: 600;
        margin-bottom: 16px;
        color: #323233;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .order-info {
        font-size: 14px;
        color: #666;
        margin-bottom: 12px;
        display: flex;
        align-items: center;
        line-height: 1.5;
    }

    .order-info i {
        margin-right: 8px;
        width: 16px;
        color: #1989fa;
    }

    /* Toast 提示样式优化 */
    .toast-container {
        position: fixed;
        top: 20px;
        right: 20px;
        z-index: 9999;
    }

    .custom-toast {
        padding: 12px 24px;
        border-radius: 8px;
        font-size: 14px;
        line-height: 1.4;
        display: flex;
        align-items: center;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        margin-bottom: 10px;
        min-width: 280px;
        max-width: 400px;
    }

    .custom-toast.success {
        background: rgba(67, 160, 71, 0.95);
        color: #fff;
    }

    .custom-toast.error {
        background: rgba(244, 67, 54, 0.95);
        color: #fff;
    }

    .custom-toast.warning {
        background: rgba(255, 152, 0, 0.95);
        color: #fff;
    }

    .custom-toast.info {
        background: rgba(33, 150, 243, 0.95);
        color: #fff;
    }

    .custom-toast i {
        margin-right: 8px;
        font-size: 16px;
    }

    /* 加载动画样式 */
    .el-loading-spinner {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .el-loading-spinner .circular {
        width: 42px;
        height: 42px;
        animation: loading-rotate 2s linear infinite;
    }

    .el-loading-spinner .path {
        stroke: #409eff;
        stroke-width: 2;
        stroke-linecap: round;
        animation: loading-dash 1.5s ease-in-out infinite;
    }

    @keyframes loading-rotate {
        100% {
            transform: rotate(360deg);
        }
    }

    @keyframes loading-dash {
        0% {
            stroke-dasharray: 1, 150;
            stroke-dashoffset: 0;
        }
        50% {
            stroke-dasharray: 90, 150;
            stroke-dashoffset: -35;
        }
        100% {
            stroke-dasharray: 90, 150;
            stroke-dashoffset: -124;
        }
    }

    /* 空状态样式 */
    .empty-tip {
        text-align: center;
        padding: 40px 0;
        color: #909399;
    }

    .empty-tip i {
        font-size: 48px;
        color: #dcdfe6;
        margin-bottom: 16px;
    }

    .empty-tip p {
        margin: 8px 0 0;
        font-size: 14px;
    }

    /* 选中标记样式 */
    .selected-mark {
        position: absolute;
        top: 10px;
        right: 10px;
        width: 26px;
        height: 26px;
        background-color: #409EFF;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    }

    .order-detail-dialog .el-dialog__header {
        background: linear-gradient(135deg, #f5f7fa, #e4f1ff);
        padding: 16px 20px;
        border-bottom: 1px solid #ebeef5;
        border-radius: 8px 8px 0 0;
    }

    .order-detail-dialog .el-dialog__title {
        font-size: 18px;
        font-weight: 600;
        color: #1989fa;
    }

    .order-detail-dialog .el-dialog__body {
        padding: 24px;
    }

    .order-detail-dialog .el-dialog__footer {
        padding: 16px 24px;
        border-top: 1px solid #ebeef5;
        background: #f9fafc;
        border-radius: 0 0 8px 8px;
    }

    .order-detail-dialog .el-descriptions {
        padding: 5px;
        border-radius: 8px;
        margin-bottom: 20px;
    }

    .order-detail-dialog .el-descriptions-item {
        margin-bottom: 10px;
    }

    .order-detail-dialog .el-descriptions-item .detail-label {
        font-weight: bold;
        background-color: #f5f7fa;
        padding: 12px 15px;
        color: #606266;
    }

    .order-detail-dialog .el-descriptions-item .detail-content {
        padding: 12px 15px;
        color: #303133;
    }

    .order-detail-dialog .el-tag {
        margin-right: 8px;
        border-radius: 4px;
        font-weight: 500;
    }

    .order-info-copy {
        margin-left: 8px;
        transition: all 0.2s ease;
    }

    .order-info-copy:hover {
        transform: scale(1.1);
        color: #409EFF;
    }

    .copy-success {
        position: fixed;
        top: 20px;
        right: 20px;
        padding: 10px 20px;
        background: rgba(103, 194, 58, 0.9);
        color: white;
        border-radius: 4px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        z-index: 9999;
        transition: all 0.3s ease;
    }

    .order-remarks {
        background: #f9f9f9;
        border-radius: 8px;
        padding: 16px;
        margin-top: 20px;
        border-left: 4px solid #67c23a;
    }

    .remarks-title {
        color: #67c23a;
        font-size: 16px;
        margin-bottom: 12px;
        font-weight: 600;
    }

    .remarks-title i {
        margin-right: 5px;
    }

    .remarks-content {
        color: #606266;
        line-height: 1.6;
        font-size: 14px;
        white-space: pre-wrap;
        word-break: break-word;
        max-height: 200px;
        overflow-y: auto;
        padding: 10px;
        background: #fff;
        border-radius: 4px;
        border: 1px solid #ebeef5;
    }
</style>
<div id="content" role="main">
    <div class="app-content-body">
        <div class="wrapper-md control" id="ydsj">
            <!-- 添加批量模式切换按钮 -->
            <div class="mode-switch">
                <el-radio-group v-model="isBatchMode" size="medium" @change="handleModeChange">
                    <el-radio-button :label="false">普通下单</el-radio-button>
                    <el-radio-button :label="true">批量下单</el-radio-button>
                </el-radio-group>
            </div>

            <!-- 正常下单模式 -->
            <div v-if="isNormalMode()" class="layui-row layui-col-space5">
                <!-- 左侧下单表单 -->
                <div class="layui-col-md6">
                    <div class="panel panel-default">
                        <div class="panel-heading" style="padding: 16px 20px; background: #f5f7fa; border-bottom: 1px solid #ebeef5;">
                            <h3 class="panel-title">
                                <i class="fas fa-paper-plane" style="color: #1989fa;"></i> 下单信息
                            </h3>
                        </div>

                        <div class="panel-body">

                            <el-form :model="orderForm" label-width="120px" size="small">
                                <!-- 在售商品下拉选择 -->
                                <el-form-item label="在售商品">
                                    <el-select v-model="orderForm.goodId" placeholder="请选择商品" style="width: 100%">
                                        <el-option label="新版国家开放大学" :value="1"></el-option>
                                                                           </el-select>
                                </el-form-item>

                                <!-- 账号信息 -->
                                <el-form-item label="账号信息">
                                    <el-input v-model="orderForm.account" placeholder="格式:账号 密码">
                                        <i slot="prefix" class="fas fa-user" style="color: #909399; margin: 0 5px;"></i>
                                    </el-input>
                                </el-form-item>

                                <!-- 仅当不是清华社英语时显示这些字段 -->
                                <template v-if="orderForm.goodId !== 2">
                                    <!-- 学习天数 -->
                                    <el-form-item label="学习天数">
                                        <el-input v-model="orderForm.learnDays" @blur="getPrice" placeholder="请输入学习天数">
                                            <i slot="prefix" class="fas fa-calendar-day" style="color: #909399; margin: 0 5px;"></i>
                                        </el-input>
                                    </el-form-item>

                                    <!-- 学习次数 -->
                                    <el-form-item label="学习次数">
                                        <el-input v-model="orderForm.learnTimes"  @blur="getPrice" placeholder="请输入学习次数">
                                            <i slot="prefix" class="fas fa-sync-alt" style="color: #909399; margin: 0 5px;"></i>
                                        </el-input>
                                    </el-form-item>

                                    <!-- 详细配置 -->
                                    <el-form-item label="详细配置">
                                        <div class="checkbox-group">
                                            <el-checkbox v-model="orderForm.doNightLearn">夜间学习</el-checkbox>
                                            <el-checkbox v-model="orderForm.doHomework">完成大作业</el-checkbox>
                                            <el-checkbox v-model="orderForm.doExam">作答形考</el-checkbox>
                                            <el-checkbox v-model="orderForm.doForum">完成讨论</el-checkbox>
                                            <el-checkbox v-model="orderForm.doActivities">完成任务点学习</el-checkbox>
                                            <el-checkbox v-model="orderForm.finishLives">观看直播回放</el-checkbox>
                                        </div>
                                    </el-form-item>

                                    <!-- 大作业提交模式 -->
                                    <el-form-item label="大作业提交模式">
                                        <el-select v-model="orderForm.doHomeworkMode" placeholder="请选择提交模式" style="width: 100%">
                                            <el-option label="直接提交" :value="1"></el-option>
                                            <el-option label="保存草稿" :value="0"></el-option>
                                        </el-select>
                                    </el-form-item>

                                    <!-- 形考提交时间间隔 -->
                                    <el-form-item label="形考提交间隔">
                                        <el-input-number v-model="orderForm.submitPeriod" :min="1" :max="10"></el-input-number>
                                        <span class="ml-2">分钟</span>
                                    </el-form-item>
                                </template>

                                <!-- 商品单价/总价 -->
                                <el-form-item :label="orderForm.goodId === 2 ? '商品总价' : '商品单价'">
                                    <div class="price-tag-container">
                                        <i class="fas fa-yen-sign" style="margin-right: 5px;"></i>
                                        <span style="color: #F56C6C; font-weight: bold;">{{ orderForm.price }}{{ orderForm.goodId !== 2 ? '/门' : '' }}</span>
                                    </div>
                                </el-form-item>

                                <!-- 下单标注/标签 -->
                                <el-form-item :label="orderForm.goodId === 2 ? '下单标签' : '下单标注'">
                                    <el-input
                                            type="textarea"
                                            v-model="orderForm.tag"
                                            :placeholder="orderForm.goodId === 2 ? '请输入下单标签' : '请输入下单备注'"
                                            :rows="3">
                                    </el-input>
                                </el-form-item>

                                <!-- 按钮区域 -->
                                <el-form-item>
                                    <el-button type="primary" @click="get">
                                        <i class="fas fa-search"></i> 查课
                                    </el-button>
                                    <el-button type="success" @click="add">
                                        <i class="fas fa-paper-plane"></i> 立即提交
                                    </el-button>
                                    <el-button @click="resetForm">
                                        <i class="fas fa-redo"></i> 重置
                                    </el-button>
                                </el-form-item>
                            </el-form>
                        </div>
                    </div>
                </div>

                <!--         右侧查询结果区域 -->
                <div class="layui-col-md6">
                 <div class="query-results-card">

                 <div class="query-results-header">
                            <div class="query-results-title">
                                <i class="fas fa-list"></i> 查询结果（选择你的课程）
                                <span style="color: rgb(51 202 187); font-weight: bold; margin-left: 15px;font-size: 16px;">
                                    选中 {{check_row.length}} 门课
                                </span>
                                <span v-if="check_row.length > 0" style="color: #ff4d4f; font-weight: bold; margin-left: 10px;font-size: 16px;">
                                需扣除 {{calculateTotalPoints()}} 积分
                              </span>
                            </div>
                            <div class="query-results-actions">
                                <button class="btn btn-sm btn-primary select-all-btn" :class="{'active': isAllSelected}" @click="selectAll" style="margin-left: 10px;">
                                    <i class="fas" :class="isAllSelected ? 'fa-check-square' : 'fa-square'"></i> {{ isAllSelected ? '取消全选' : '全选' }}
                                </button>
                            </div>
                        </div>

                        <div class="panel-body" >
                            <form class="form-horizontal devform">
                                <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
                                    <div v-for="(rs,key) in row ">
                                        <div class="panel panel-default">
                                            <div class="panel-heading" role="tab" id="headingOne">
                                                <h4 class="panel-title">
                                                    <a role="button" data-toggle="collapse" data-parent="#accordion" :href="'#'+key"
                                                       aria-expanded="true">
                                                        <b>{{rs.userName}}</b> {{rs.userinfo}} <span
                                                                v-if="rs.msg.includes('查询成功') || rs.msg.includes('查课成功') || rs.msg.includes('Success！') || rs.msg.includes('Success') || rs.msg.includes('success')"><span
                                                                    class="el-tag el-tag--success el-tag--dark"><b>{{rs.msg}}</b></span></span>
                                                        <span v-else-if="rs.msg!='查询成功'">
                              <span class="el-tag el-tag--danger el-tag--dark"><b>{{rs.msg}}</b></span></span>

                                                    </a>

                                                </h4>
                                            </div>
                                            <div :id="key" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
                                                <div class="panel-body">
                                                    <div v-for="(res,key) in rs.data" :key="key">
                                                        <div class="course-item"
                                                             :style="sex.some(item => item.id === res.id && item.name === res.name) ?
                                                                    'background-color: #ecf5ff !important; border: 2px solid #409eff !important; transform: translateY(-2px) !important; box-shadow: 0 4px 12px rgba(64,158,255,.3) !important;' : ''"
                                                             @click="selectCourse(res, rs.userinfo, rs.userName, rs.data)">
                                                            <div class="course-info">
                                                                <span class="course-name">{{res.name}}</span>
                                                                <span class="course-id" v-if="kcidAllValue == 1">课程ID：{{res.id}}</span>
                                                            </div>
                                                            <!-- 添加选中标记 -->
                                                            <div v-if="sex.some(item => item.id === res.id && item.name === res.name)" class="selected-mark">
                                                                <i class="fas fa-check-circle" style="color: white !important; font-size: 18px;"></i>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>

                    </div>

                </div>
             </div>

            <!-- 批量下单模式 -->
            <div v-else class="layui-row layui-col-space5">
                    <!-- 左侧批量下单表单 -->
                    <div class="layui-col-md6">
                        <div class="panel panel-default">
                            <div class="panel-heading" style="padding: 16px 20px; background: #f5f7fa; border-bottom: 1px solid #ebeef5;">
                                <h3 class="panel-title">
                                    <i class="fas fa-list-ol"></i> 批量下单信息
                                </h3>
                            </div>
                            <div class="panel-body">
                                <el-form :model="batchOrderForm" label-width="120px" size="small">
                                    <!-- 在售商品下拉选择 -->
                                    <el-form-item label="在售商品">
                                        <el-select v-model="batchOrderForm.goodId" placeholder="请选择商品" style="width: 100%" disabled>
                                            <el-option label="新版国家开放大学" :value="1"></el-option>
                                        </el-select>
                                    </el-form-item>

                                    <!-- 学习天数 -->
                                    <el-form-item label="学习天数">
                                        <el-input v-model="batchOrderForm.learnDays" @blur="getPriceBat" placeholder="请输入学习天数">
                                            <i slot="prefix" class="fas fa-calendar-day" style="color: #909399; margin: 0 5px;"></i>
                                        </el-input>
                                    </el-form-item>

                                    <!-- 学习次数 -->
                                    <el-form-item label="学习次数">
                                        <el-input v-model="batchOrderForm.learnTimes" @blur="getPriceBat" placeholder="请输入学习次数">
                                            <i slot="prefix" class="fas fa-sync-alt" style="color: #909399; margin: 0 5px;"></i>
                                        </el-input>
                                    </el-form-item>

                                    <!-- 详细配置 -->
                                    <el-form-item label="详细配置">
                                        <div class="checkbox-group">
                                            <el-checkbox v-model="batchOrderForm.doNightLearn">夜间学习</el-checkbox>
                                            <el-checkbox v-model="batchOrderForm.doHomework">完成大作业</el-checkbox>
                                            <el-checkbox v-model="batchOrderForm.doExam">作答形考</el-checkbox>
                                            <el-checkbox v-model="batchOrderForm.doForum">完成讨论</el-checkbox>
                                            <el-checkbox v-model="batchOrderForm.doActivities">完成任务点学习</el-checkbox>
                                            <el-checkbox v-model="batchOrderForm.finishLives">观看直播回放</el-checkbox>
                                        </div>
                                    </el-form-item>

                                    <!-- 大作业提交模式 -->
                                    <el-form-item label="大作业提交模式">
                                        <el-select v-model="batchOrderForm.doHomeworkMode" placeholder="请选择提交模式" style="width: 100%">
                                            <el-option label="直接提交" :value="1"></el-option>
                                            <el-option label="保存草稿" :value="0"></el-option>
                                        </el-select>
                                    </el-form-item>

                                    <!-- 形考提交时间间隔 -->
                                    <el-form-item label="形考提交时间间隔">
                                        <el-input-number v-model="orderForm.submitPeriod" :min="1" :max="10"></el-input-number>
                                        <span class="ml-2">分钟</span>
                                    </el-form-item>

                                    <!-- 商品单价 -->
                                    <el-form-item label="商品单价">
                                        <div class="price-tag-container">
                                            <i class="fas fa-yen-sign" style="margin-right: 5px;"></i>
                                            <span style="color: #F56C6C; font-weight: bold;">{{ batchOrderForm.price }}/门</span>
                                        </div>
                                    </el-form-item>

                                    <!-- 下单标注 -->
                                    <el-form-item label="下单标注">
                                        <el-input
                                                type="textarea"
                                                v-model="batchOrderForm.tag"
                                                placeholder="请输入下单备注"
                                                :rows="3">
                                        </el-input>
                                    </el-form-item>

                                    <!-- 按钮区域 -->
                                    <el-form-item>
                                        <el-button type="primary" @click="uploadExcel">
                                            <i class="fas fa-file-upload"></i> 上传Excel
                                        </el-button>
                                        <el-button type="success" @click="submitBatchOrder">
                                            <i class="fas fa-paper-plane"></i> 批量提交
                                        </el-button>
                                    </el-form-item>

                                    <div class="upload-tip">
                                        <i class="fas fa-info-circle" style="color: #909399;"></i>
                                        注意：1. 请使用模板上传Excel文件，2. 文件请按规范上传，3. 仅支持Excel文件
                                    </div>
                                </el-form>
                            </div>
                        </div>
                    </div>

                    <!-- 右侧批量账号表格 -->
                    <div class="layui-col-md6">
                        <div class="panel panel-default">
                            <div class="panel-heading" style="padding: 16px 20px; background: #f5f7fa; border-bottom: 1px solid #ebeef5;">
                                <h3 class="panel-title">
                                    <i class="fas fa-list-alt"></i> 批量账号列表
                                </h3>
                            </div>
                            <div class="panel-body">
                                <div v-if="batchLoading" style="text-align: center; padding: 40px 0;">
                                    <i class="fas fa-spinner fa-spin" style="font-size: 32px; color: #409eff; margin-bottom: 10px;"></i>
                                    <p>处理中，请稍候...</p>
                                </div>

                                <div v-else>
                                    <el-table
                                            :data="batchAccounts"
                                            style="width: 100%"
                                            border
                                            max-height="400">
                                        <el-table-column prop="account" label="账号" width="150"></el-table-column>
                                        <el-table-column prop="password" label="密码" width="150"></el-table-column>
                                        <el-table-column prop="course" label="课程"></el-table-column>
                                    </el-table>

                                    <div class="batch-actions">
                                        <div>
                                            <span style="color: #606266;">共 <b>{{ batchAccounts.length }}</b> 条数据，总价: <span class="price-highlight">¥ {{ batchTotalPrice }}</span></span>
                                        </div>
                                        <div>
                                            <el-button type="danger" size="small" @click="clearBatchAccounts">
                                                <i class="fas fa-trash-alt"></i> 清空
                                            </el-button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- 订单列表区域 -->
                <div class="panel panel-default" style="margin-top: 20px;">
                    <div class="panel-heading" style="padding: 16px 20px; background: #f5f7fa; border-bottom: 1px solid #ebeef5;">
                        <h3 class="panel-title">
                            <i class="fas fa-list"></i> 订单列表
                        </h3>
                    </div>

                    <div class="panel-body">
                        <!-- 搜索框 -->
                        <div class="search-box">
                            <el-row :gutter="15">
                                <el-col :span="6">
                                    <el-select v-model="searchType" placeholder="查询类型" style="width: 100%">
                                        <el-option label="订单ID" value="id"></el-option>
                                        <el-option label="账号信息" value="account"></el-option>
                                        <el-option label="课程名称" value="course_name"></el-option>
                                        <el-option label="下单标签" value="tag"></el-option>
                                    </el-select>
                                </el-col>
                                <el-col :span="12">
                                    <el-input v-model="cx.oid" placeholder="请输入搜索内容" clearable>
                                        <i slot="prefix" class="fas fa-search" style="color: #909399; margin: 14px 5px;"></i>
                                    </el-input>
                                </el-col>
                                <el-col :span="6">
                                    <el-button type="primary" @click="searchOrders(1)">
                                        <i class="fas fa-search"></i> 搜索
                                    </el-button>
                                    <el-button @click="resetSearch">
                                        <i class="fas fa-redo"></i> 重置
                                    </el-button>
                                </el-col>
                            </el-row>
                        </div>

                        <!-- 订单卡片列表 -->
                        <div v-if="orderList.length > 0">
                            <div class="order-card" v-for="item in orderList" :key="item.oid">
                                <div class="order-title">
                                    订单 #{{item.oid}}
                                    <span class="status-tag"
                                        :class="item.status=='异常' ? 'status-error' :
                                               item.status=='已完成' ? 'status-completed' :
                                               item.status=='进行中' ? 'status-processing' :
                                               'status-pending'">
                                        <i :class="item.status=='异常' ? 'fas fa-exclamation-circle' :
                                                  item.status=='已完成' ? 'fas fa-check-circle' :
                                                  item.status=='进行中' ? 'fas fa-spinner fa-spin' :
                                                  'fas fa-clock'"></i>
                                        {{item.status}}
                                    </span>
                                </div>

                                <div class="order-info">
                                    <i class="fas fa-user"></i> 账号：{{item.user}}
                                </div>
                                <div class="order-info">
                                    <i class="fas fa-user"></i> 密码：{{item.pass}}
                                </div>
                                <div class="order-info">
                                    <i class="fas fa-book"></i> 课程：{{item.kcname}}
                                </div>

                                <div class="order-info">
                                    <i class="fas fa-project-diagram"></i> 渠道：{{item.ptname}}
                                </div>

                                <div class="order-info">
                                    <i class="fas fa-chart-line"></i> 学习天数/次数：{{item.learnDays}}/{{item.learnTimes}}
                                </div>
                                <div class="order-info">
                                    <i class="fas fa-spinner fa-spin"></i> 进度：{{item.process}}
                                </div>
                                <div class="order-info">
                                    <i class="fas fa-comment-dots"></i> 备注：{{item.remarks}}
                                </div>

                                <div class="order-info">
                                    <i class="fas fa-calendar"></i> 创建时间：{{item.addtime}}
                                </div>

                                <div class="order-info">
                                    <i class="fas fa-yen-sign"></i> 价格：<span style="color: #F56C6C; font-weight: 500;">{{item.fees}}</span>
                                </div>

                                <div style="margin-top: 15px; display: flex; justify-content: flex-end;">
                                    <el-button type="primary" size="small" @click="viewOrderDetail(item)">
                                        <i class="fas fa-info-circle"></i> 详情
                                    </el-button>
                                    <el-button type="info" size="small" @click="copyOrderInfo(item)">
                                        <i class="fas fa-copy"></i> 复制
                                    </el-button>
                                    <el-button type="warning" size="small" @click="refreshOrder(item.oid)">
                                        <i class="fas fa-sync"></i> 更新状态
                                    </el-button>
                                    <el-button type="danger" size="small" @click="rechargeOrder(item.oid)" :disabled="item.status=='已退款'">
                                        <i class="fas fa-redo"></i> 补刷订单
                                    </el-button>
                                </div>
                            </div>

                            <!-- 分页 -->
                        <div style="text-align: center; margin-top: 20px;">
                            <ul class="pagination pagination-circle" v-if="last_page>1">
            					<li class="disabled"><a @click="searchOrders(1)">首页</a></li>
            					<li class="disabled"><a @click="current_page>1?searchOrders(current_page-1):''">&laquo;</a></li>
                                    <li @click="searchOrders(current_page-3)" v-if="current_page-3>=1"><a>{{current_page-3 }}</a></li>
                                    <li @click="searchOrders(current_page-2)" v-if="current_page-2>=1"><a>{{current_page-2 }}</a></li>
                                    <li @click="searchOrders(current_page-1)" v-if="current_page-1>=1"><a>{{current_page-1 }}</a></li>
                                    <li :class="{'active':current_page=current_page}" @click="searchOrders(current_page)" v-if="current_page"><a>{{ current_page }}</a></li>
                                    <li @click="searchOrders(current_page+1)" v-if="current_page+1<=last_page"><a>{{ current_page+1 }}</a></li>
                                    <li @click="searchOrders(current_page+2)" v-if="current_page+2<=row.last_page"><a>{{current_page+2 }}</a></li>
                                    <li @click="searchOrders(current_page+3)" v-if="current_page+3<=last_page"><a>{{current_page+3 }}</a></li>
                                    <li class="disabled"><a @click="last_page>current_page?searchOrders(current_page+1):''">&raquo;</a></li>
            					<li class="disabled"><a @click="searchOrders(last_page)">尾页</a></li>
            				</ul>
                            </div>
                        </div>

                        <!-- 空状态 -->
                        <div v-else class="empty-tip" style="text-align: center; padding: 40px 0; color: #909399;">
                            <i class="fas fa-inbox" style="font-size: 48px; color: #dcdfe6; margin-bottom: 16px; display: block;"></i>
                            <p>暂无订单数据</p>
                        </div>
                    </div>
                </div>

                <!-- 订单详情弹窗 -->
                <el-dialog title="订单详情" :visible.sync="detailDialogVisible" width="750px" custom-class="order-detail-dialog">
                    <el-descriptions :column="2" border class="order-details">
                        <el-descriptions-item label="订单ID" label-class-name="detail-label" content-class-name="detail-content">{{ currentOrder.oid }}</el-descriptions-item>
                        <el-descriptions-item label="渠道" label-class-name="detail-label" content-class-name="detail-content">{{ currentOrder.ptname }}</el-descriptions-item>
                        <el-descriptions-item label="账号信息" label-class-name="detail-label" content-class-name="detail-content">{{ currentOrder.user }}</el-descriptions-item>
                        <el-descriptions-item label="密码" label-class-name="detail-label" content-class-name="detail-content">{{ currentOrder.pass }}</el-descriptions-item>
                        <el-descriptions-item label="课程名称" label-class-name="detail-label" content-class-name="detail-content">{{ currentOrder.kcname }}</el-descriptions-item>
                        <el-descriptions-item label="学习天数/次数" label-class-name="detail-label" content-class-name="detail-content">{{ currentOrder.learnDays }}/{{ currentOrder.learnTimes }}</el-descriptions-item>
                        <el-descriptions-item label="价格" label-class-name="detail-label" content-class-name="detail-content">
                            <span style="color: #F56C6C; font-weight: 500;">{{ currentOrder.fees }}</span>
                        </el-descriptions-item>
                        <el-descriptions-item label="状态" label-class-name="detail-label" content-class-name="detail-content">
                            <el-tag :type="currentOrder.status=='异常' ? 'danger' :
                                       currentOrder.status=='已完成' ? 'success' :
                                       currentOrder.status=='进行中' ? 'warning' :
                                       'info'">{{ currentOrder.status }}</el-tag>
                        </el-descriptions-item>
                        <el-descriptions-item label="进度" label-class-name="detail-label" content-class-name="detail-content">{{ currentOrder.process || '0%' }}</el-descriptions-item>
                        <el-descriptions-item label="创建时间" label-class-name="detail-label" content-class-name="detail-content">{{ currentOrder.addtime }}</el-descriptions-item>
                        <el-descriptions-item label="详细配置" :span="2" label-class-name="detail-label" content-class-name="detail-content">
                            <el-tag v-if="currentOrder.doNightLearn == 1" size="small" type="success" style="margin-right: 5px">夜间学习</el-tag>
                            <el-tag v-if="currentOrder.doHomework == 1" size="small" type="success" style="margin-right: 5px">完成大作业</el-tag>
                            <el-tag v-if="currentOrder.doExam == 1" size="small" type="success" style="margin-right: 5px">作答形考</el-tag>
                            <el-tag v-if="currentOrder.doForum == 1" size="small" type="success" style="margin-right: 5px">完成讨论</el-tag>
                            <el-tag v-if="currentOrder.doActivities == 1" size="small" type="success" style="margin-right: 5px">完成任务点学习</el-tag>
                            <el-tag v-if="currentOrder.finishLives == 1" size="small" type="success" style="margin-right: 5px">观看直播回放</el-tag>
                        </el-descriptions-item>
                        <el-descriptions-item label="下单标签" :span="2" label-class-name="detail-label" content-class-name="detail-content">{{ currentOrder.tag || '无' }}</el-descriptions-item>
                    </el-descriptions>

                    <!-- 备注单独放在下面 -->
                    <div class="order-remarks" v-if="currentOrder.remarks">
                        <h4 class="remarks-title"><i class="fas fa-sticky-note"></i> 备注信息</h4>
                        <div class="remarks-content">{{ currentOrder.remarks }}</div>
                    </div>

                    <div slot="footer" class="dialog-footer">
                        <el-button @click="detailDialogVisible = false">关闭</el-button>
                        <el-button type="primary" @click="copyOrderInfo(currentOrder)">
                            <i class="fas fa-copy"></i> 复制订单信息
                        </el-button>
                    </div>
                </el-dialog>

                <!-- 添加账号对话框 -->
                <el-dialog title="添加账号" :visible.sync="addAccountDialogVisible" width="400px">
                    <el-form :model="newAccount" label-width="80px">
                        <el-form-item label="账号">
                            <el-input v-model="newAccount.account" placeholder="请输入账号"></el-input>
                        </el-form-item>
                        <el-form-item label="密码">
                            <el-input v-model="newAccount.password" placeholder="请输入密码" show-password></el-input>
                        </el-form-item>
                        <el-form-item label="课程">
                            <el-input v-model="newAccount.course" placeholder="请输入课程名称"></el-input>
                        </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button @click="addAccountDialogVisible = false">取 消</el-button>
                        <el-button type="primary" @click="confirmAddAccount">确 定</el-button>
                    </div>
                </el-dialog>

                <!-- 上传Excel对话框 -->
                <el-dialog title="上传Excel" :visible.sync="uploadDialogVisible" width="400px">
                    <el-upload
                            class="upload-demo"
                            drag
                            action="#"
                            :auto-upload="false"
                            :on-change="handleExcelChange"
                            :file-list="fileList"
                            accept=".xlsx,.xls">
                        <i class="el-icon-upload"></i>
                        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
                        <div class="el-upload__tip" slot="tip">只能上传Excel文件，且不超过10MB</div>
                    </el-upload>
                    <div slot="footer" class="dialog-footer">
                        <el-button @click="uploadDialogVisible = false">取 消</el-button>
                        <el-button type="primary" @click="processExcelFile">解 析</el-button>
                        <el-button type="success" @click="downloadTemplate">下载模板</el-button>
                    </div>
                </el-dialog>
            </div>
        </div>
    </div>

    <!-- 添加必要的脚本依赖 -->
    <script type="text/javascript" src="assets/LightYear/js/jquery.min.js"></script>

    <script src="assets/LightYear/js/jquery-tags-input/jquery.tagsinput.min.js"></script>

    <script type="text/javascript" src="assets/LightYear/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="assets/LightYear/js/perfect-scrollbar.min.js"></script>
    <script type="text/javascript" src="assets/LightYear/js/main.min.js"></script>
    <script type="text/javascript" src="assets/layui/layui.js"></script>
    <script src="assets/js/vue.min.js"></script>
    <script type="text/javascript" src="pengzi/element-ui/index.js"></script>
    <script src="pengzi/marked.min.js"></script>
    <script src="assets/js/aes.js"></script>

    <script src="assets/js/vue-resource.min.js"></script>
    <script src="assets/js/axios.min.js"></script>
    <script src="assets/js/element.js"></script>
    <script src="assets/LightYear/js/xlsx.full.min.js"></script>

    <!-- 添加Excel处理所需的脚本 -->
<!--    <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js"></script>-->

    <script>
        // 创建一个简单的通知系统
        ;(function() {
            // 通知容器
            let notifyContainer = document.createElement('div');
            notifyContainer.className = 'notify-container';
            notifyContainer.style.cssText = 'position:fixed;top:20px;right:20px;z-index:9999;width:320px;';
            document.body.appendChild(notifyContainer);

            // 通知方法
            Vue.prototype.$notify = function(options) {
                let notifyEl = document.createElement('div');
                let typeClass = options.type || 'info';
                let typeIcon = '';

                switch(typeClass) {
                    case 'success':
                        typeIcon = '<i class="layui-icon layui-icon-ok-circle"></i>';
                        break;
                    case 'error':
                    case 'danger':
                        typeIcon = '<i class="layui-icon layui-icon-close-fill"></i>';
                        break;
                    case 'warning':
                        typeIcon = '<i class="layui-icon layui-icon-alert"></i>';
                        break;
                    default:
                        typeIcon = '<i class="layui-icon layui-icon-about"></i>';
                }

                notifyEl.className = 'notify-item notify-' + typeClass;
                notifyEl.style.cssText = 'background:#fff;border-radius:6px;box-shadow:0 2px 12px rgba(0,0,0,0.1);margin-bottom:16px;padding:16px;overflow:hidden;transform:translateX(100%);transition:all 0.3s;opacity:0;';

                let html = `
                    <div style="display:flex;align-items:flex-start;">
                        <div style="background:${typeClass === 'success' ? '#33CABB' : typeClass === 'error' || typeClass === 'danger' ? '#FF6B6B' : typeClass === 'warning' ? '#FFC107' : '#409EFF'};color:#fff;border-radius:50%;width:24px;height:24px;display:flex;align-items:center;justify-content:center;margin-right:10px;flex-shrink:0;">
                            ${typeIcon}
                        </div>
                        <div style="flex:1;">
                            <h4 style="margin:0 0 5px;font-size:16px;font-weight:bold;color:#333;">${options.title || ''}</h4>
                            <div style="font-size:14px;color:#666;">${options.message || ''}</div>
                        </div>
                    </div>
                `;

                notifyEl.innerHTML = html;
                notifyContainer.appendChild(notifyEl);

                // 触发重绘以应用过渡效果
                setTimeout(() => {
                    notifyEl.style.transform = 'translateX(0)';
                    notifyEl.style.opacity = '1';
                }, 10);

                // 播放通知音效
                if (options.playSound !== false) {
                    try {
                        const audio = new Audio('assets/1.wav');
                        audio.volume = 0.4;
                        audio.play().catch(e => {
                            // 静默处理播放失败
                        });
                    } catch(e) {
                        // 静默处理错误
                    }
                }

                // 设置自动关闭
                let duration = options.duration || 3000;
                let closeTimeout = setTimeout(() => {
                    closeNotify();
                }, duration);

                // 关闭通知
                function closeNotify() {
                    notifyEl.style.transform = 'translateX(100%)';
                    notifyEl.style.opacity = '0';

                    setTimeout(() => {
                        if (notifyEl.parentNode) {
                            notifyContainer.removeChild(notifyEl);
                        }
                    }, 300);
                }

                // 鼠标悬停时暂停关闭计时
                notifyEl.addEventListener('mouseenter', () => {
                    clearTimeout(closeTimeout);
                });

                // 鼠标离开时恢复关闭计时
                notifyEl.addEventListener('mouseleave', () => {
                    closeTimeout = setTimeout(closeNotify, 1000);
                });

                // 提供关闭方法
                return {
                    close: closeNotify
                };
            };
        })();

        new Vue({
            el: '#ydsj',
            data() {
                return {
                    cx: {
        				oid: ''
        			},
                    check_row: [],
                    kcidAllValue: 0,
                    class1: '',
                    showImages: false, // 修改为默认隐藏图片
                    row: [],
                    sex: [],
                    isAllSelected: false, // 全选状态标识
                    isBatchMode: false, // 确保这个属性在data中正确定义
                    _suppressNotification: false, // 控制是否显示searchOrders的通知
                    orderForm: {
                        cid: '100000',
                        account: '',
                        password: '',
                        tag: '',
                        submitPeriod: 1,
                        learnTimes: 500,
                        learnDays: 5,
                        finishLives: false,
                        doForum: false,
                        doExam: false,
                        doHomework: false,
                        doActivities: false,
                        doHomeworkMode: 1,
                        doNightLearn: false,
                        price: '2.00',
                        goodId: 1  // 添加默认值为1
                    },
                    sbMsg:'',
                    loading: false,
                    tableLoading: false,
                    courses: [],
                    selectedCourses: [],
                    multipleSelection: [],
                    orderList: [],
                    current_page: 1,    //当前页
                    limit: 20,   //每页显示多少行
                    total_count: 0,   //总记录数
                    last_page:1, //最后一页
                    detailDialogVisible: false,
                    currentOrder: {},
                    searchType: 'id',
                    searchKeyword: '',
                    originalOrderList: [],

                    // 新增批量模式数据
                    batchOrderForm: {
                        goodId: 1, // 默认选择新版国家开放大学
                        learnDays: 5,
                        learnTimes: 500,
                        doNightLearn: false,
                        doForum: false,
                        doExam: false,
                        doHomework: false,
                        doActivities: false,
                        finishLives: false,
                        doHomeworkMode: 1,
                        submitPeriod: 1,
                        price: '2.00',
                        tag: ''
                    },
                    batchAccounts: [], // 批量账号列表
                    batchLoading: false,
                    addAccountDialogVisible: false,
                    newAccount: {
                        account: '',
                        password: '',
                        course: ''
                    },
                    uploadDialogVisible: false,
                    fileList: []
                }
            },
            computed: {
                totalSelectedPrice() {
                    const unitPrice = parseFloat(this.orderForm.price);
                    return (this.multipleSelection.length * unitPrice).toFixed(2);
                },

                batchTotalPrice() {
                    const unitPrice = parseFloat(this.batchOrderForm.price);
                    return (this.batchAccounts.length * unitPrice).toFixed(2);
                }
            },
            created() {
                this.searchOrders(1)
                this.getPrice();
                this.getPriceBat();
            },
            watch: {
                'orderForm.goodId'(newVal) {
                    if (newVal === 2) {
                        this.orderForm.price = '10.00';
                    } else {
                        this.orderForm.price = '2.00';
                    }
                }
            },
            methods: {
                handleSelectionChange(val) {
                    this.multipleSelection = val
                },

                selectAllCourses() {
                    this.$refs.courseTable.toggleAllSelection()
                },

                clearSelection() {
                    this.$refs.courseTable.clearSelection()
                },

                viewOrderDetail(row) {
                    this.currentOrder = {
                        ...row,
                        doNightLearn: row.doNightLearn || 0,
                        doHomework: row.doHomework || 0,
                        doExam: row.doExam || 0,
                        doForum: row.doForum || 0,
                        doActivities: row.doActivities || 0,
                        finishLives: row.finishLives || 0,
                        tag: row.tag || '无标签'
                    }
                    this.detailDialogVisible = true
                },

                searchOrders(page) {
                    // if (!this.cx.oid) {
                    //     this.$message.warning('请输入搜索关键词')
                    //     return
                    // }

                    this.tableLoading = true

                    data = {
                        cx: this.cx,
                        pagesize: this.limit,
                        page: page
                    }
                    this.$http.post("/apisub.php?act=orderlist_huoxi", data, {
                        emulateJSON: true
                    }).then(function (data) {
                        this.tableLoading = false
                        if (data.data.code == 1) {
                            this.orderList = data.body.data;
                            this.current_page = data.body.current_page;
                            this.total_count = data.body.total_count;
                            this.last_page = data.body.last_page;


                            // 重置标志
                            this._suppressNotification = false;
                        } else {
                            this.$notify({
                                title: '查询失败',
                                message: data.data.msg,
                                type: 'error'
                            });
                        }
                    });
                },

                resetSearch() {
                    this.searchType = 'id'
                    this.searchKeyword = ''

                    if (this.originalOrderList.length > 0) {
                        this.orderList = [...this.originalOrderList]
                        this.total = this.orderList.length
                    } else {
                        this.searchOrders(1)
                    }
                },

                getStatusType(status) {
                    const types = {
                        0: 'info',
                        1: 'warning',
                        2: 'success',
                        3: 'danger'
                    }
                    return types[status] || 'info'
                },

                getStatusText(status) {
                    const texts = {
                        0: '待处理',
                        1: '处理中',
                        2: '已完成',
                        3: '已失败'
                    }
                    return texts[status] || '未知'
                },

                addBatchAccount() {
                    this.newAccount = {
                        account: '',
                        password: '',
                        course: ''
                    };
                    this.addAccountDialogVisible = true;
                },

                confirmAddAccount() {
                    if (!this.newAccount.account || !this.newAccount.password || !this.newAccount.course) {
                        this.$notify({
                            title: '添加失败',
                            message: '账号、密码和课程都不能为空',
                            type: 'error'
                        });
                        return;
                    }

                    this.batchAccounts.push({...this.newAccount});
                    this.addAccountDialogVisible = false;
                    this.$notify({
                        title: '添加成功',
                        message: '添加账号成功',
                        type: 'success'
                    });
                },

                removeBatchAccount(index) {
                    this.batchAccounts.splice(index, 1);
                },

                clearBatchAccounts() {
                    this.$confirm('确定要清空所有账号吗?', '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                    }).then(() => {
                        this.batchAccounts = [];
                        this.$notify({
                            title: '清空成功',
                            message: '已清空账号列表',
                            type: 'success'
                        });
                    }).catch(() => {});
                },

                uploadExcel() {
                    this.fileList = [];
                    this.uploadDialogVisible = true;
                },

                handleExcelChange(file) {
                    this.fileList = [file];
                },

                processExcelFile() {
                    if (this.fileList.length === 0) {
                        this.$notify({
                            title: '警告',
                            message: '请先选择Excel文件',
                            type: 'warning'
                        });
                        return;
                    }

                    const file = this.fileList[0].raw;
                    if (!file) {
                        this.$notify({
                            title: '错误',
                            message: '文件无效',
                            type: 'error'
                        });
                        return;
                    }

                    this.$notify({
                        title: '解析中',
                        message: '正在解析Excel文件，请稍候...',
                        type: 'info'
                    });

                    const reader = new FileReader();
                    reader.onload = (e) => {
                        try {
                            const data = new Uint8Array(e.target.result);
                            const workbook = XLSX.read(data, { type: 'array' });

                            // 读取第一个工作表
                            const firstSheetName = workbook.SheetNames[0];
                            const worksheet = workbook.Sheets[firstSheetName];

                            // 输出调试信息
                            console.log('工作表名称:', firstSheetName);
                            console.log('工作表数据:', worksheet);

                            // 转换为JSON
                            const json = XLSX.utils.sheet_to_json(worksheet, { header: "A" });

                            console.log('解析后数据:', json);

                            if (json.length === 0) {
                                this.$notify({
                                    title: '错误',
                                    message: 'Excel文件为空或格式不正确',
                                    type: 'error'
                                });
                                return;
                            }

                            // 获取表头行
                            const headers = json[0];
                            const headerMap = {};

                            // 查找列标识
                            Object.keys(headers).forEach(key => {
                                const value = headers[key];
                                if (typeof value === 'string') {
                                    const lowerValue = value.toLowerCase();
                                    if (lowerValue === '账号' || lowerValue === '学号') {
                                        headerMap.account = key;
                                    } else if (lowerValue === '密码') {
                                        headerMap.password = key;
                                    } else if (lowerValue === '课程') {
                                        headerMap.course = key;
                                    }
                                }
                            });

                            console.log('列映射:', headerMap);

                            // 检查是否找到了所有必需的列
                            if (!headerMap.account || !headerMap.password || !headerMap.course) {
                                this.$notify({
                                    title: '错误',
                                    message: 'Excel文件格式不正确，必须包含"学号/账号"、"密码"和"课程"三列',
                                    type: 'error'
                                });
                                return;
                            }

                            // 解析Excel数据
                            const accounts = [];
                            for (let i = 1; i < json.length; i++) {
                                const row = json[i];
                                const account = row[headerMap.account];
                                const password = row[headerMap.password];
                                const course = row[headerMap.course];

                                if (account && password && course) {
                                    accounts.push({
                                        account: String(account),
                                        password: String(password),
                                        course: String(course)
                                    });
                                }
                            }

                            if (accounts.length === 0) {
                                this.$notify({
                                    title: '错误',
                                    message: '未找到有效数据，请检查Excel格式是否正确',
                                    type: 'error'
                                });
                                return;
                            }

                            this.batchAccounts = accounts;
                            this.$notify({
                                title: '成功',
                                message: `成功导入 ${accounts.length} 条账号数据`,
                                type: 'success'
                            });
                            this.uploadDialogVisible = false;
                        } catch (error) {
                            console.error('Excel解析错误:', error);
                            this.$notify({
                                title: '错误',
                                message: 'Excel解析失败: ' + error.message,
                                type: 'error'
                            });
                        }
                    };

                    reader.onerror = (e) => {
                        console.error('文件读取错误:', e);
                        this.$notify({
                            title: '错误',
                            message: '文件读取失败',
                            type: 'error'
                        });
                    };

                    reader.readAsArrayBuffer(file);
                },

                downloadTemplate() {
                    // 创建一个与您的Excel格式一致的模板
                    const worksheet = XLSX.utils.aoa_to_sheet([
                        ['学号', '密码', '课程'],
                        ['13800138000', 'password123', '机械设计基础'],
                        ['13900139000', 'password456', '可编程控制器应用']
                    ]);

                    const workbook = XLSX.utils.book_new();
                    XLSX.utils.book_append_sheet(workbook, worksheet, '批量下单模板');

                    // 生成并下载文件
                    XLSX.writeFile(workbook, '批量下单模板.xlsx');
                },

                get: function () {
                    // if(this.orderForm.goodId == 1){
                    //     this.orderForm.cid = '100000';
                    // }

                    if (this.orderForm.cid == '' || this.orderForm.account == '') {
                        this.$notify({
                            title: '错误',
                            message: '信息格式错误，请检查',
                            type: 'error'
                        });
                        return false;
                    }

                    userinfo = this.orderForm.account.replace(/\r\n/g, "[br]").replace(/\n/g, "[br]").replace(/\r/g, "[br]");
                    userinfo = userinfo.split('[br]'); // 分割
                    this.row = [];
                    this.check_row = [];

                    // 显示全局加载中
                    const loading = this.$loading({
                        lock: true,
                        text: '查询课程中...',
                        spinner: 'el-icon-loading',
                        background: 'rgba(0, 0, 0, 0.7)'
                    });

                    const promises = [];

                    for (var i = 0; i < userinfo.length; i++) {
                        let info = userinfo[i]; // 使用let确保作用域正确
                        if (!info.trim()) continue; // 跳过空行

                        let hash = getENC('<?php echo $addsalt; ?>');

                        // 创建请求Promise
                        let requestPromise = this.$http.post("/apisub.php?act=get", {
                            cid: this.orderForm.cid,
                            userinfo: info,
                            hash
                        }, {
                            emulateJSON: true
                        });

                        promises.push(requestPromise.then(response => {
                            if (response.data.code == -7) {
                                const salt = getENC(response.data.msg);
                                return this.get(salt);
                                } else {
                                this.row.push(response.data);
                                return response.data;
                            }
                        }).catch(error => {
                            console.error('查询失败:', error);
                            this.$notify({
                                title: '查询失败',
                                message: '请求失败，请重试',
                                type: 'error'
                            });
                            return null;
                        }));
                    }

                    // 当所有请求完成后关闭加载提示
                    Promise.all(promises).then(() => {
                        loading.close();
                        if (this.row.length > 0) {
                            this.$notify({
                                title: '查询成功',
                                message: `成功查询 ${this.row.length} 个账号的课程`,
                                type: 'success'
                            });
                        }
                    }).catch(() => {
                        loading.close();
                    });
                },
                checkResources: function (userinfo, userName, rs, id, name) {
                    let aa;
                    for (let i = 0; i < rs.length; i++) {
                        if (id == "") {
                            if (rs[i].name == name) {
                                aa = rs[i];
                            }
                        } else {
                            if (rs[i].id == id && rs[i].name == name) {
                                aa = rs[i];
                            }
                        }
                    }

                    const data = {
                        userinfo,
                        userName,
                        data: aa
                    };

                    if (this.check_row.length < 1) {
                        this.check_row.push(data);
                    } else {
                        let found = false;
                        for (let i = 0; i < this.check_row.length; i++) {
                            if (this.check_row[i].userinfo === data.userinfo && this.check_row[i].data.name === data.data.name) {
                                found = true;
                                this.check_row.splice(i, 1);
                                break;
                            }
                        }
                        if (!found) {
                            this.check_row.push(data);
                        }
                    }
                },
                submitBatchOrder() {
                    if (this.batchAccounts.length === 0) {
                        this.$notify({
                            title: '警告',
                            message: '请先添加账号',
                            type: 'warning'
                        });
                        return;
                    }

                    const convertBoolToNum = (bool) => bool ? 1 : 0;

                    // 构建批量订单数据
                    const batchOrders = this.batchAccounts.map(account => {
                        return {
                            // courseName: account.course,
                            userinfo:account.account+' '+account.password,
                            data:{
                                name:account.course
                            }
                            // tag: this.batchOrderForm.tag,
                            // submitPeriod: this.batchOrderForm.submitPeriod,
                            // learnTimes: parseInt(this.batchOrderForm.learnTimes),
                            // learnDays: parseInt(this.batchOrderForm.learnDays),
                            // finishLives: convertBoolToNum(this.batchOrderForm.finishLives),
                            // doForum: convertBoolToNum(this.batchOrderForm.doForum),
                            // doExam: convertBoolToNum(this.batchOrderForm.doExam),
                            // doHomework: convertBoolToNum(this.batchOrderForm.doHomework),
                            // doActivities: convertBoolToNum(this.batchOrderForm.doActivities),
                            // doHomeworkMode: this.batchOrderForm.doHomeworkMode,
                            // doNightLearn: convertBoolToNum(this.batchOrderForm.doNightLearn)
                        };
                    });

                    console.log('提交批量订单数据:', batchOrders);

                    this.$confirm(`确认提交 ${this.batchAccounts.length} 个订单吗？`, '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                    }).then(() => {
                        var loading = layer.load(2);
                        this.$http.post("/apisub.php?act=add-gk", {
                            cid: this.orderForm.cid,
                            data: batchOrders,
                            submitPeriod: this.batchOrderForm.submitPeriod,
                            learnTimes: this.batchOrderForm.learnTimes,
                            learnDays: this.batchOrderForm.learnDays,
                            finishLives: this.batchOrderForm.finishLives?1:0,
                            doForum: this.batchOrderForm.doForum?1:0,
                            doExam: this.batchOrderForm.doExam?1:0,
                            doHomework: this.batchOrderForm.doHomework?1:0,
                            doActivities: this.batchOrderForm.doActivities?1:0,
                            doHomeworkMode: this.batchOrderForm.doHomeworkMode?1:0,
                            doNightLearn: this.batchOrderForm.doNightLearn?1:0,
                            goodId: this.batchOrderForm.goodId
                            // ,
                            // shichang: shichang,
                            // score: score
                        }, {
                            emulateJSON: true
                        }).then(function (data) {
                            layer.close(loading);
                            if (data.data.code == 1) {
                                this.row = [];
                                this.check_row = [];
                                this.batchAccounts = [];
                                this.$notify({
                                    title: '成功',
                                    message: data.data.msg,
                                    type: 'success'
                                });

                                // 确保在调用 setTimeout 时传入的函数可以正常执行
                                setTimeout(function () {
                                    window.location.href = ""; // 在这里添加需要跳转的URL
                                },3000); // 可以设置延迟时间，例如3000毫秒（3秒）

                            } else {
                                this.$notify({
                                    title: '错误',
                                    message: data.data.msg,
                                    type: 'error'
                                });
                            }
                        });

                    }).catch(() => {
                        this.$notify({
                            title: '已取消',
                            message: '已取消提交',
                            type: 'info'
                        });
                    });
                },
                add: function () {
                    // if (this.wzy_status != this.wzy_old_status) {
                    //     layer.msg("您已变更渠道，请重新查课");
                    //     return false;
                    // }
                    // if (this.wzy_status2 != this.wzy_old_status2) {
                    //     layer.msg("您已变更渠道，请重新查课");
                    //     return false;
                    // }

                    if (this.orderForm.cid == '') {
                        layer.msg("请先查课");
                        return false;
                    }
                    // 增加严格的检查
                    if (this.check_row.length < 1) {
                        layer.msg("请先选择课程");
                        return false;
                    }
                    if (this.sex.length < 1) {
                        layer.msg("请确保至少选择了一项课程");
                        return false;
                    }

                    var loading = layer.load(2);
                    // score = $("#range_02").val();
                    // shichang = $("#range_01").val();
                    this.$http.post("/apisub.php?act=add-gk", {
                        cid: this.orderForm.cid,
                        data: this.check_row,
                        submitPeriod: this.orderForm.submitPeriod,
                        learnTimes: this.orderForm.learnTimes,
                        learnDays: this.orderForm.learnDays,
                        finishLives: this.orderForm.finishLives?1:0,
                        doForum: this.orderForm.doForum?1:0,
                        doExam: this.orderForm.doExam?1:0,
                        doHomework: this.orderForm.doHomework?1:0,
                        doActivities: this.orderForm.doActivities?1:0,
                        doHomeworkMode: this.orderForm.doHomeworkMode?1:0,
                        doNightLearn: this.orderForm.doNightLearn?1:0,
                        goodId: this.orderForm.goodId
                        // ,
                        // shichang: shichang,
                        // score: score
                    }, {
                        emulateJSON: true
                    }).then(function (data) {
                        layer.close(loading);
                        if (data.data.code == 1) {
                            this.row = [];
                            this.check_row = [];
                            this.$notify({
                                title: '成功',
                                message: data.data.msg,
                                type: 'success'
                            });

                            // 确保在调用 setTimeout 时传入的函数可以正常执行
                            setTimeout(function () {
                                window.location.href = ""; // 在这里添加需要跳转的URL
                            },3000); // 可以设置延迟时间，例如3000毫秒（3秒）

                        } else {
                            this.$notify({
                                title: '错误',
                                message: data.data.msg,
                                type: 'error'
                            });
                        }
                    });
                },
                //统计扣除积分
                getPrice() {
                    // if(this.orderForm.goodId == 1){
                    //     this.orderForm.cid = '100000';
                    // }
                    //获取商品单价
                    this.$http.post("/apisub.php?act=getPrice", {
                        // hid: '1137',
                        // goodId: this.orderForm.goodId,
                        times: this.orderForm.learnTimes,
                        days: this.orderForm.learnDays
                        // ,
                        // period: this.orderForm.submitPeriod
                    }, {
                        emulateJSON: true
                    }).then(function (data) {
                        this.orderForm.price = Number(data.data.price);
                        this.orderForm.cid =Number(data.data.cid);
                        // this.batchOrderForm.price = Number(data.data.price);
                    });
                },
                //统计扣除积分
                getPriceBat() {
                    // if(this.orderForm.goodId == 1){
                    //     this.orderForm.cid = '100000';
                    // }
                    //获取商品单价
                    this.$http.post("/apisub.php?act=getPrice", {
                        // hid: '1137',
                        // goodId: this.orderForm.goodId,
                        times: this.batchOrderForm.learnTimes,
                        days: this.batchOrderForm.learnDays
                        // ,
                        // period: this.orderForm.submitPeriod
                    }, {
                        emulateJSON: true
                    }).then(function (data) {
                        this.batchOrderForm.price = Number(data.data.price);
                        this.batchOrderForm.cid =Number(data.data.cid);
                        // this.batchOrderForm.price = Number(data.data.price);
                    });
                },
                //统计扣除积分
                calculateTotalPoints() {
                    let total = 0;
                    // if(this.orderForm.goodId == 1){
                    //     this.orderForm.cid = '100000';
                    // }
                    //获取商品单价
                    this.$http.post("/apisub.php?act=getPrice", {
                        // hid: '1137',
                        // goodId: this.orderForm.goodId,
                        times: this.orderForm.learnTimes,
                        // period: this.orderForm.submitPeriod,
                        days: this.orderForm.learnDays
                    }, {
                        emulateJSON: true
                    }).then(function (data) {
                        this.orderForm.price = Number(data.data.price);
                    });
                    total = this.check_row.length*this.orderForm.price;
                    // 保留一位小数
                    return Math.floor(total * 10) / 10;
                },
                selectAll() {
                    this.isAllSelected = !this.isAllSelected;

                    // 清空现有选择
                    this.check_row = [];
                    this.sex = [];

                    // 清除所有课程的选中状态和样式
                    const clearAllSelections = () => {
                        document.querySelectorAll('.course-item').forEach(item => {
                            item.style.backgroundColor = '';
                            item.style.borderColor = '';
                            item.style.transform = '';
                            item.style.boxShadow = '';
                            const mark = item.querySelector('.selected-mark');
                            if (mark) mark.remove();
                        });
                    };

                    if (this.isAllSelected) {
                        // 执行全选
                        this.row.forEach(rs => {
                            rs.data.forEach(res => {
                                this.sex.push({...res});
                                const courseData = rs.data.find(item => item.id === res.id && item.name === res.name);
                                if (courseData) {
                                    this.check_row.push({
                                        userinfo: rs.userinfo,
                                        userName: rs.userName,
                                        data: courseData
                                    });
                                }
                            });
                        });

                        // 应用选中样式
                        this.$nextTick(() => {
                            clearAllSelections();
                            document.querySelectorAll('.course-item').forEach(item => {
                                item.style.backgroundColor = '#ecf5ff';
                                item.style.borderColor = '#409eff';
                                item.style.transform = 'translateY(-2px)';
                                item.style.boxShadow = '0 4px 12px rgba(64,158,255,.3)';

                                const mark = document.createElement('div');
                                mark.className = 'selected-mark';
                                mark.innerHTML = '<i class="fas fa-check-circle" style="color: white !important; font-size: 18px;"></i>';
                                item.appendChild(mark);
                            });
                        });
                    } else {
                        // 取消全选，清除所有样式
                        this.$nextTick(clearAllSelections);
                    }
                },
                // 重置表单
                resetForm() {
                    this.orderForm = {
                        cid: '100000',
                        account: '',
                        password: '',
                        tag: '',
                        submitPeriod: 1,
                        learnTimes: 500,
                        learnDays: 5,
                        finishLives: false,
                        doForum: false,
                        doExam: false,
                        doHomework: false,
                        doActivities: false,
                        doHomeworkMode: 1,
                        doNightLearn: false,
                        price: '2.00'
                    };
                    this.row = [];
                    this.check_row = [];
                    this.sex = [];
                    this.isAllSelected = false;

                    // 显示提示
                    this.$notify({
                        title: '重置成功',
                        message: '表单已重置',
                        type: 'success'
                    });
                },
                // 选择课程
                selectCourse(res, userinfo, userName, data) {
                    // 获取所有相同课程的元素（可能在不同账号下有相同课程）
                    const courseElements = document.querySelectorAll('.course-item');
                    const targetElement = event.currentTarget;

                    // 判断是否已在选中列表中
                    const isSelected = this.sex.some(item => item.id === res.id && item.name === res.name);

                    // 清除指定元素的选中状态
                    const clearElementSelection = (element) => {
                        if (!element) return;
                        element.style.backgroundColor = '';
                        element.style.borderColor = '';
                        element.style.transform = '';
                        element.style.boxShadow = '';
                        const marks = element.querySelectorAll('.selected-mark');
                        marks.forEach(mark => mark.remove());
                    };

                    // 应用选中样式到指定元素
                    const applyElementSelection = (element) => {
                        if (!element) return;
                        element.style.backgroundColor = '#ecf5ff';
                        element.style.border = '2px solid #409eff';
                        element.style.transform = 'translateY(-2px)';
                        element.style.boxShadow = '0 4px 12px rgba(64,158,255,.3)';

                        // 确保没有现有的选中标记
                        const existingMarks = element.querySelectorAll('.selected-mark');
                        existingMarks.forEach(mark => mark.remove());

                        // 添加新的选中标记
                        const mark = document.createElement('div');
                        mark.className = 'selected-mark';
                        mark.innerHTML = '<i class="fas fa-check-circle" style="color: white !important; font-size: 18px;"></i>';
                        element.appendChild(mark);
                    };

                    if (isSelected) {
                        // 取消选择
                        this.sex = this.sex.filter(item => !(item.id === res.id && item.name === res.name));
                        this.check_row = this.check_row.filter(item =>
                            !(item.userinfo === userinfo &&
                              item.data.id === res.id &&
                              item.data.name === res.name)
                        );

                        // 清除所有相同课程的选中状态
                        courseElements.forEach(element => {
                            const courseName = element.querySelector('.course-name');
                            if (courseName && courseName.textContent === res.name) {
                                clearElementSelection(element);
                            }
                        });
                    } else {
                        // 添加选择
                        this.sex.push({...res});
                        this.checkResources(userinfo, userName, data, res.id, res.name);

                        // 先清除当前元素的选中状态，然后应用新的选中状态
                        clearElementSelection(targetElement);
                        applyElementSelection(targetElement);
                    }

                    // 更新全选状态
                    const totalCourses = this.row.reduce((total, r) => total + r.data.length, 0);
                    this.isAllSelected = this.sex.length === totalCourses;

                    // 更新全选按钮状态
                    if (!this.isAllSelected) {
                        const allSelectBtn = document.querySelector('.select-all-btn i');
                        if (allSelectBtn) {
                            allSelectBtn.className = 'fas fa-square';
                        }
                    }

                    // 强制更新视图
                    this.$nextTick(() => {
                        // 再次检查并清理任何残留的选中标记
                        if (!isSelected) {
                            courseElements.forEach(element => {
                                if (element !== targetElement) {
                                    const courseName = element.querySelector('.course-name');
                                    if (courseName && courseName.textContent === res.name) {
                                        clearElementSelection(element);
                                    }
                                }
                            });
                        }
                    });
                },
                cx: function () {
                    if (this.cx.oid == '') {
                        this.$notify({
                            title: '提示',
                            message: '请输入订单号',
                            type: 'warning'
                        });
                        return false;
                    }
                    var loading = layer.load(2);
                    this.$http.post("/apisub.php?act=cx", {
                        oid: this.cx.oid
                    }, {
                        emulateJSON: true
                    }).then(function (data) {
                        layer.close(loading);
                        if (data.data.code == 1) {
                            this.$notify({
                                title: '查询结果',
                                message: data.data.msg,
                                type: 'success'
                            });
                        } else {
                            this.$notify({
                                title: '查询失败',
                                message: data.data.msg,
                                type: 'error'
                            });
                        }
                    });
                },

                refreshOrder(oid) {
                    if (!oid) {
                        this.$notify({
                            title: '错误',
                            message: '订单ID无效',
                            type: 'error'
                        });
                        return;
                    }

                    const loading = this.$loading({
                        lock: true,
                        text: '处理中...',
                        spinner: 'el-icon-loading',
                        background: 'rgba(0, 0, 0, 0.7)'
                    });

                    // 调用API更新订单状态
                    this.$http.get("/apisub.php?act=uporder&oid=" + oid, {
                        emulateJSON: true
                    }).then(response => {
                        loading.close();
                        if (response.data.code == 1) {
                            // 添加成功通知
                            this.$notify({
                                title: '成功',
                                message: response.data.msg || '订单状态已更新',
                                type: 'success'
                            });
                            // 设置标志，防止searchOrders中再次显示通知
                            this._suppressNotification = true;
                            // 刷新订单列表
                            this.searchOrders(this.current_page);
                        } else {
                            this.$notify({
                                title: '错误',
                                message: response.data.msg || '更新状态失败',
                                type: 'error'
                            });
                        }
                    }).catch(error => {
                        loading.close();
                        this.$notify({
                            title: '错误',
                            message: '更新状态请求失败',
                            type: 'error'
                        });
                        console.error('更新状态失败:', error);
                    });
                },

                rechargeOrder(oid) {
                    if (!oid) {
                        this.$notify({
                            title: '错误',
                            message: '订单ID无效',
                            type: 'error'
                        });
                        return;
                    }

                    const loading = this.$loading({
                        lock: true,
                        text: '正在处理补刷请求...',
                        spinner: 'el-icon-loading',
                        background: 'rgba(0, 0, 0, 0.7)'
                    });

                    // 调用API补刷订单
                    this.$http.get("/apisub.php?act=bs&oid=" + oid, {
                        emulateJSON: true
                    }).then(response => {
                        loading.close();
                        if (response.data.code == 1) {
                            this.$notify({
                                title: '成功',
                                message: response.data.msg || '补刷请求已提交',
                                type: 'success'
                            });
                            // 设置标志，防止searchOrders中再次显示通知
                            this._suppressNotification = true;
                            // 刷新订单列表
                            this.searchOrders(this.current_page);
                        } else {
                            this.$notify({
                                title: '错误',
                                message: response.data.msg || '补刷请求失败',
                                type: 'error'
                            });
                        }
                    }).catch(error => {
                        loading.close();
                        this.$notify({
                            title: '错误',
                            message: '补刷请求发送失败',
                            type: 'error'
                        });
                        console.error('补刷请求失败:', error);
                    });
                },

                // 添加复制订单信息方法
                copyOrderInfo(order) {
                    // 构建要复制的文本
                    let copyText = `订单ID: ${order.oid}\n`;
                    copyText += `账号: ${order.user}\n`;
                    copyText += `密码: ${order.pass}\n`;
                    copyText += `课程: ${order.kcname}\n`;
                    copyText += `渠道: ${order.ptname}\n`;
                    copyText += `学习天数/次数: ${order.learnDays}/${order.learnTimes}\n`;
                    copyText += `状态: ${order.status}\n`;
                    copyText += `进度: ${order.process || '0%'}\n`;
                    copyText += `备注: ${order.remarks || '无'}\n`;
                    copyText += `创建时间: ${order.addtime}\n`;
                    copyText += `价格: ${order.fees}`;

                    // 创建临时textarea元素
                    const textarea = document.createElement('textarea');
                    textarea.value = copyText;
                    textarea.setAttribute('readonly', '');
                    textarea.style.position = 'absolute';
                    textarea.style.left = '-9999px';
                    document.body.appendChild(textarea);

                    // 选中并复制文本
                    textarea.select();
                    document.execCommand('copy');

                    // 移除临时元素
                    document.body.removeChild(textarea);

                    // 显示成功提示
                    const successTip = document.createElement('div');
                    successTip.className = 'copy-success';
                    successTip.innerHTML = '<i class="fas fa-check-circle"></i> 订单信息已复制到剪贴板';
                    document.body.appendChild(successTip);

                    // 2秒后移除提示
                    setTimeout(() => {
                        successTip.style.opacity = '0';
                        setTimeout(() => {
                            document.body.removeChild(successTip);
                        }, 300);
                    }, 2000);
                },
                search: function () {
                    if (this.orderForm.account == '') {
                        this.$notify({
                            title: '提示',
                            message: '请输入账号',
                            type: 'warning'
                        });
                        return false;
                    }
                    if (this.orderForm.password == '') {
                        this.$notify({
                            title: '提示',
                            message: '请输入密码',
                            type: 'warning'
                        });
                        return false;
                    }
                    var loading = layer.load(2);
                    this.wzy_old_status = this.wzy_status;
                    this.wzy_old_status2 = this.wzy_status2;

                    // score = $("#range_02").val();
                    // shichang = $("#range_01").val();
                    this.$http.post("/apisub.php?act=query", {
                        account: this.orderForm.account,
                        password: this.orderForm.password,
                        cg: this.orderForm.cg
                    }, {
                        emulateJSON: true
                    }).then(function (data) {
                        layer.close(loading);
                        if (data.data.code == 1) {
                            this.row = data.data.data;
                            this.orderForm.cid = data.data.id;
                            this.sceClassList();
                            this.$notify({
                                title: '查询成功',
                                message: '获取到' + Object.keys(data.data.data).length + '个账号',
                                type: 'success'
                            });

                        } else {
                            this.$notify({
                                title: '查询失败',
                                message: data.data.msg,
                                type: 'error'
                            });
                        }
                    });
                },
                handleModeChange(value) {
                    // 直接设置模式值，确保响应性
                    this.isBatchMode = value ? true : false;

                    // 处理模式切换逻辑
                    if (value) {
                        // 切换到批量模式
                        this.$notify({
                            title: '模式切换',
                            message: '已切换到批量下单模式',
                            type: 'info'
                        });
                        // 重置批量表单数据
                        this.batchAccounts = [];
                    } else {
                        // 切换到普通模式
                        this.$notify({
                            title: '模式切换',
                            message: '已切换到普通下单模式',
                            type: 'info'
                        });
                        // 可以在这里重置普通下单表单
                        this.row = [];
                        this.check_row = [];
                        this.sex = [];
                    }

                    // 强制更新视图
                    this.$nextTick(() => {
                        this.$forceUpdate();
                    });
                },
                isNormalMode() {
                    // 直接返回布尔值
                    return this.isBatchMode === false;
                },
                isBatchDownloadMode() {
                    // 直接返回布尔值
                    return this.isBatchMode === true;
                },
                forceUpdate() {
                    this.$forceUpdate();
                }
            }
        })
    </script>
